package com.manlu.controller;

import com.manlu.service.UserService;
import com.manlu.vo.BaseResult;
import com.manlu.vo.QueryInfo;
import com.manlu.vo.UserPageInfoVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Auther 漫路h
 * Created by 2020-05-05 19:54
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;


    /**
     * 修改小程序用户状态,根据用户id
     * @param state 状态
     * @return
     */
    @PutMapping("/{uid}/{state}")
    public BaseResult editUserState(@PathVariable("uid") Integer uid, @PathVariable("state") Integer state){
        return userService.editUserState(uid,state);
    }

    /**
     * 根据用户id删除用户
     * @param uid 用户uid
     * @return
     */
    @DeleteMapping("/{uid}")
    public BaseResult deleteUserByUid(@PathVariable Integer uid){
        return userService.deleteUserByUid(uid);
    }

    /**
     * 查询小程序用户列表,(分页)
     * @param userPageInfoVo
     * @return
     */
    @GetMapping
    public BaseResult selectAllByPage(UserPageInfoVo userPageInfoVo){
        return userService.selectAllByPage(userPageInfoVo);
    }
}
